//
//  ZHDrawerMenuHeaderView.m
//  ZHS_UCDemo
//
//  Created by Emrys on 2016/11/10.
//  Copyright © 2016年 Emrys. All rights reserved.
//

#import "ZHDrawerMenuHeaderView.h"

#import "ZHImageView.h"

static const CGFloat kMenuHeaderHeight_leader_0 = 200;
static const CGFloat kMenuHeaderHeight_leader_1 = 160;

@interface ZHDrawerMenuHeaderView ()

@property(nonatomic, strong) ZHImageView *logoImageView;


@end

@implementation ZHDrawerMenuHeaderView

+ (instancetype)drawerMenuHeaderWithLeaderSymbol:(NSInteger)leaderSymbol {

    ZHDrawerMenuHeaderView *header = [[self alloc] initWithFrame:CGRectZero];
    
    if (header) {
        
        CGRect headerFrame = header.frame;
        
        switch (leaderSymbol) {
                case 0:
                
                headerFrame.size.height = kMenuHeaderHeight_leader_0;
                
                break;
                case 1:
                
                headerFrame.size.height = kMenuHeaderHeight_leader_1;
                
                break;
            default:
                break;
        }
        
        header.frame = headerFrame;
        
        return header;
    }
    
    return nil;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.logoImageView.center = self.contentView.center;
}

- (void)setLogoImageName:(NSString *)logoImageName {
    _logoImageName = logoImageName;
    
    UIImage *logoImage = [UIImage imageNamed:logoImageName];
    
    if (logoImage) {
        self.logoImageView = [[ZHImageView alloc] initWithImage:logoImage];
        [self.contentView addSubview:self.logoImageView];
        
        self.logoImageView.center = self.contentView.center;
    }
}

@end
